package com.hefeng.service.impl;

import java.util.Date;
import java.util.List;

import com.github.pagehelper.PageHelper;
import com.hefeng.domain.WxUser;
import com.hefeng.mapper.WxUserMapper;
import com.hefeng.service.IWxUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 微信用户Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-09-02
 */
@Service
public class WxUserServiceImpl implements IWxUserService
{
    @Autowired
    private    WxUserMapper wxUserMapper;

    /**
     * 查询微信用户
     * 
     * @param userId 微信用户主键
     * @return 微信用户
     */
    @Override
    public WxUser selectWxUserByUserId(Integer userId)
    {
        return wxUserMapper.selectWxUserByUserId(userId);
    }

    /**
     * 查询微信用户列表
     * 
     *
     * @return 微信用户
     */
    @Override
    public List<WxUser> selectWxUserList(Integer pageNum,Integer pageSize)
    {
        PageHelper.startPage(pageNum, pageSize);
        return wxUserMapper.selectWxUserList();

    }

    /**
     * 新增微信用户
     * 
     * @param wxUser 微信用户
     * @return 结果
     */
    @Override
    public int insertWxUser(WxUser wxUser)
    {
        wxUser.setWxState(1);
        wxUser.setCreatedTime(new Date());
        return wxUserMapper.insertWxUser(wxUser);
    }

    /**
     * 修改微信用户
     * 
     * @param wxUser 微信用户
     * @return 结果
     */
    @Override
    public int updateWxUser(WxUser wxUser)
    {
        wxUser.setUpdatedTime(new Date());
        return wxUserMapper.updateWxUser(wxUser);
    }

    /**
     * 批量删除微信用户
     * 
     * @param userIds 需要删除的微信用户主键
     * @return 结果
     */
    @Override
    public int deleteWxUserByUserIds(Integer[] userIds)
    {
        return wxUserMapper.deleteWxUserByUserIds(userIds);
    }


}
